
import {Credentials} from '@src/store/reducers/userReducer'
import { User } from 'user'
import { UserTypes } from '../types/userTypes'


export namespace UserActions{

    //清空用户信息
    export interface ClearUser{
        type:UserTypes.CLEAR_USER
    }

    //保存用户登录凭据的Action对象的类型
    export interface SaveCredentials{
        type: UserTypes.SAVE_CREDENTIALS
        payload:Credentials
    }

    //获取管理员信息的Action对象的类型
    // 获取管理员信息
    export interface RequestUserInfo{
        type: UserTypes.REQUEST_USER_INFO

    }
    // 获取管理员信息成功
    export interface RequestUserInfoSuccess{
        type:UserTypes.REQUEST_USER_INFO_SUCCESS,
        payload:User
    }

    //获取管理员失败
    export interface RequestUserInfoError{
        type:UserTypes.REQUEST_USER_INFO_ERROR,
        error: string | null
    }


    export type Actions = SaveCredentials | RequestUserInfo | RequestUserInfoSuccess |RequestUserInfoError |ClearUser
}